﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Espam.Idiomas.Decimo.Tesis.Negocio;

namespace Espam.Idiomas.Decimo.Tesis.Web
{
    public partial class Alumnos : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string validaSession;

            if (Session["userEspamIdiomasVarSession001"] == null || Session["rolEspamIdiomasVarSession003"] == null)
            {
                validaSession = "NoHaIniciadoSession";
                Response.Redirect("UI_Login.aspx?validaSession=" + validaSession);
            }
            else if (Session["userEspamIdiomasVarSession001"] != null && Session["rolEspamIdiomasVarSession003"].ToString() == "Docente")
            {
                Response.Redirect("UI_DashboardTeacher.aspx");
            }
            else if (Session["userEspamIdiomasVarSession001"] != null && Session["rolEspamIdiomasVarSession003"].ToString() == "Administradores")
            {
                Response.Redirect("Default.aspx");
            }
            else if (Session["userEspamIdiomasVarSession001"] != null && Session["rolEspamIdiomasVarSession003"].ToString() == "Alumno")
            {
                Validaciones oValidaciones = new Validaciones();
                string nombre = "";
                string apellido = "";
                string[] name;
                string[] lastName;
                imgProfile.ImageUrl = "http://181.196.143.4/SIST_ESPAM/fotos/" + Session["cadPicEspamIdiomasVarSession005"].ToString() + ".jpg";
                imgProfile1.ImageUrl = "http://181.196.143.4/SIST_ESPAM/fotos/" + Session["cadPicEspamIdiomasVarSession005"].ToString() + ".jpg";
                //lblName.Text = Session["nameEspamIdiomasVarSession006"].ToString();
                //lblApellido.Text = Session["lastNameEspamIdiomasVarSession005"].ToString();
                nombre = Session["nameEspamIdiomasVarSession006"].ToString();
                apellido = Session["lastNameEspamIdiomasVarSession005"].ToString();
                lblApellido.Text = apellido;
                name = oValidaciones.UserName(nombre);
                lblName.Text = name[0];
                lastName = oValidaciones.UserName(apellido);
                lblName1.Text = name[0];
                lblApellido1.Text = lastName[0];
                //Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
                //Response.Cache.SetAllowResponseInBrowserHistory(false);
                //Response.Cache.SetNoStore();

            }
        }
    }
}